<template>
  <div>
   <h1>房号增加</h1>
   <table class="table table-bordered"> 
    <tbody>
      <tr>
        <td>房号名称</td>
        <td>
          <input type="type" v-model="info.fhcnam">
        </td>
      </tr>

      <tr>
        <td>序号</td>
        <td>
          <input type="text" v-model="info.fxMceng">
        </td>
      </tr>

      <tr>
        <td>房号状态</td>
        <td>
          <input type="radio" value="1" name="zt" v-model="info.hFzt">上架
          <input type="radio" value="0" name="zt" v-model="info.hFzt">下架
        </td>
      </tr>

      <tr>
        <td>时间</td>
        <td>
          <input type="date" v-model="info.sdata">
        </td>
      </tr>

      <tr>
        <td></td>
        <td>
          <input type="button" value="增加" class="btn btn-success" @click="Ok">
        </td>
      </tr>
    </tbody>
   </table>
  </div>
</template>

<script setup lang="ts">
import {ref,reactive,onMounted} from 'vue';
import axios from 'axios'
import { useRoute,useRouter } from 'vue-router';
let route=useRoute();
let router=useRouter()


const info=reactive({
  "id": 0,
  "fhcnam": "",
  "hFzt": 1,
  "sdata": "",
  "fxMceng": ""
})

const Ok=()=>{
  axios.post("https://localhost:7177/api/Fhao/AddtjFh",info).then(res=>{
    if(res.data>0)
  {
    alert('添加成功');
    return;
  }
  else{
    if(res.data==-1)
  {
    alert('名称重复');
    return;
  }
  else{
    alert('添加失败');
    return;
  }
    
  }
  })
}

</script>

<style scoped>

</style>